Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
How to stop VS from removing "unused" namespaces if they are actually used in preprocessor directives?

I'm using Visual Studios Code Cleanup on Save to automatically clean my code when i save. It also removes unused namespaces. But now i noticed that it even removes namespaces when they are actually in use in preprocessor directives. What can i do to avoid it?

enter image description here

Code is here:

    private void RegisterTracking()
    {
#if DEBUG
        IResourceFilePostProcessor processor = null;
#else
        IResourceFilePostProcessor processor = new ResourceFilePostProcessor();
#endif
        For<ITrackingResourceFileService>().Add(new TrackingResourceFileService(processor));
    }    

Actually i think this is a visual studio bug because it should not be seen as unused.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Putting the using in a preprocessor directive seems to work.

#if !DEBUG
using xyz.EpiServer.Core.Tracking;
#endif
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!